package com.demo.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.*;

/**
 * @author Lei.Jie
 * @apiNote TODO
 * <p>
 * @since 2025/3/4 15:14
 */
@RestController
@RequestMapping("/demo")
public class DemoController {

    @RequestMapping("/hello")
    public Object hello() {
        Map<String, Object> map = new HashMap<>();
        List<Map<String, String>> list = new ArrayList<>();
        //随机100以内的整形
        Random random = new Random();
        int num = random.nextInt(20-1+1) + 1;
        for (int i = 0; i < num; i++) {
            list.add(Map.of("id",i+"","name","张三"+i));
        }
        map.put("title", ""+ LocalDateTime.now());
        map.put("data2",list);
        return map;
    }
}
